package com.lenovo.leos.filebrowser.netdisk;

import android.os.Bundle;

public class LoadNetDiskOp extends NetDiskOp implements Cloneable{
	private static final String TAG = "LoadNetDiskOp";
	
	public enum State {
		none,
		ready,
		start,
		run,
		pause,
		stop,
		error,
		finish;
	}
	
	public enum Type {
		download_file,
		upload_file,
		download_dir,
		upload_dir,
		do_pause,
		do_run,
		do_start,
		do_ready,
		do_stop,
		do_clean,
		do_clean_all,
		invalid;
	}
	
	private Type mType = Type.invalid;
	private State mState = State.none;
	private double miProgress = 0;
	private double mtotallen = 0;
	
	public LoadNetDiskOp(Type type, Bundle data) {
		super(data);
		
		if (type == Type.invalid || null == data){
			Log.e(TAG, "invalid parameter in LoadNetDiskOp");
		}else{
			mType = type;
			mState = State.ready;			
		}
	}
	
	public Type getType() {
		return mType;
	}
	
	public State getState() {
		return mState;
	}
	
	public void setState(State state) {
		mState = state;
	}
	
	
	
	public double getProgress(){
		return miProgress;
	}
	
	public void setProgress(double progress) {
		Log.i(TAG,"==>setProgress"+progress);
		miProgress = progress;
	}
	public void setTotalLength(double totallength){
		Log.i(TAG,"==>setTotalLength"+totallength);
		mtotallen = totallength;
	}
	public double getTotalLength(){
		Log.i(TAG,"==>setTotalLength"+mtotallen);
		return mtotallen;
	}
	public Object clone() {
		LoadNetDiskOp o = null;  
        try {  
            o = (LoadNetDiskOp) super.clone();  
            o.mState = mState;
            o.mType= mType;
            o.miProgress = miProgress;
            o.mtotallen = mtotallen;
            } catch (CloneNotSupportedException e) {  
            e.printStackTrace();  
        }  
        return o; 
	}

}